/**
 * 应用状态管理相关的类型定义
 */

import type { HistoryVersion } from './history'
import type { FileTreeNode } from './file-operations'
import type { SearchResult } from './search'
import type { RecoveryTask } from './recovery'


// 应用主状态
export interface AppState {
  currentVersion: string | null
  selectedFiles: string[]
  searchQuery: string
  searchResults: SearchResult[]
  recoveryQueue: RecoveryTask[]
  isLoading: boolean
  error: string | null
}

// 版本浏览状态
export interface VersionBrowserState {
  versions: HistoryVersion[]
  currentVersionFiles: FileTreeNode[]
  selectedVersion: string | null
  expandedFolders: Set<string>
}

// 文件历史状态
export interface FileHistoryState {
  selectedFilePath: string | null
  historyRecords: FileHistoryRecord[]
  isLoadingHistory: boolean
}

// 搜索状态
export interface SearchState {
  query: string
  results: SearchResult[]
  isSearching: boolean
  searchOptions: SearchOptions
  totalResults: number
  currentPage: number
}

// 恢复状态
export interface RecoveryState {
  activeRecoveries: RecoveryTask[]
  completedRecoveries: RecoveryResult[]
  isRecovering: boolean
  progress: RecoveryProgress
}

// 恢复进度
export interface RecoveryProgress {
  current: number
  total: number
  currentFile: string
  percentage: number
}

// UI状态
export interface UIState {
  sidebarCollapsed: boolean
  activeTab: 'browser' | 'history' | 'search' | 'recovery'
  theme: 'light' | 'dark'
  notifications: Notification[]
}

// 通知信息
export interface Notification {
  id: string
  type: 'success' | 'warning' | 'error' | 'info'
  title: string
  message: string
  timestamp: number
  duration?: number
}

// 重新导出需要的类型
import type { FileHistoryRecord } from './history'
import type { SearchOptions } from './search'
import type { RecoveryResult } from './recovery'

export type { 
  FileHistoryRecord,
  SearchOptions,
  RecoveryResult
}